using System;
using System.Windows.Forms;
using System.Drawing;

public enum DGVTextBoxColumnStyle { None, ID, Currency, Description };

public class DGVTextBoxColumn : DataGridViewTextBoxColumn, IDGVColumn
{
    private DGVTextBoxColumnStyle style = DGVTextBoxColumnStyle.None;

    public DGVTextBoxColumn(DGVTextBoxColumnStyle Style)
        : base()
    {
        this.style = Style;

        switch (Style)
        {
            case DGVTextBoxColumnStyle.ID:
                base.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                base.DefaultCellStyle.BackColor = SystemColors.Control;
                base.ReadOnly = true;
                break;
            case DGVTextBoxColumnStyle.Currency:
                base.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                base.DefaultCellStyle.Format = "N2";
                break;
            case DGVTextBoxColumnStyle.Description:
                base.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                break;
            default:
                break;
        }
    }

    public DGVTextBoxColumn()
        : base()
    {
    }

    public DGVTextBoxColumnStyle Style
    {
        get { return this.style; }
    }

    // IDGVColumn.EditingLabel()
    public Label EditingLabel()
    {
        return new DBLabel(this.HeaderText);
    }

    // IDGVColumn.EditingControl()
    public Control EditingControl()
    {
        switch (this.Style)
        {
            case DGVTextBoxColumnStyle.None:
            case DGVTextBoxColumnStyle.ID:
            case DGVTextBoxColumnStyle.Description:
                return new DBTextBox(this);
            case DGVTextBoxColumnStyle.Currency:
                return new DBMaskedTextBox(this);
            default:
                return null;
        }
    }
}
